{include file="public/_meta" /}

<title>基本设置</title>
<style type="text/css">
	.award{
		display: flex;
		justify-content: flex-start;
		flex-wrap: wrap;
	}
	.award .row{
		width:20%;
		display: block;
	}
	.award .row .form-label{
		width: 50%;
		padding: 0;
		
	}
	.award .row .formControls{
		width: 50%;
		padding: 0;
	}
	.award .row .formControls>input{
		width: 100% !important;
	}
	.col-sm-2{
		width: 25%;
	}
</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	系统管理
	<span class="c-gray en">&gt;</span>
	奖励设置
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" onclick="ooo()" title="清楚缓存" ><i class="Hui-iconfont">&#xe706;</i></a>&nbsp;&nbsp;&nbsp;&nbsp;
</nav>
<div class="page-container">
	<form class="form form-horizontal" id="form-article-add">
		<div id="tab-system" class="HuiTab">

			<div class="tabCon ">

	           <div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span>
						(前端)设置周期排名：(天)</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="paiming"  value="{:cache('setting')['paiming']}" class="input-text" style="width:10%">
					</div>
				</div>


				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span>
						运营中心业绩奖励：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="award0"  value="{:cache('setting')['award0']}" class="input-text" style="width:10%">
					</div>
				</div>

				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span>
						用户购买商品，店主所拿金额：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="dian_money"  value="{:cache('setting')['dian_money']}" class="input-text" style="width:10%">
					</div>
				</div>

				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">
						<span class="c-red">*</span>
						用户购买商品，运营中心所拿金额:</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="yun_money"  value="{:cache('setting')['yun_money']}" class="input-text" style="width:10%">
					</div>
				</div>

<!--				设置运营中心业绩日期范围：-->
<!--				<input type="text" class="input-text Wdate" name="start" id="countTimestart" onfocus="selecttime(1)" value="{$Request.get.start|default=''}" size="17" class="date" readonly style="width:140px;">-->
<!--				- -->
<!--				<input type="text" class="input-text Wdate" name="end" id="countTimeend" onfocus="selecttime(2)" value="{$Request.get.end|default=''}" size="17"  class="date" readonly style="width:140px;">-->

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onclick="return saveConfig();" class="btn btn-primary radius" type="submit"><i clsass="Hui-iconfont">&#xe632;</i> 保存</button>
<!--				<button class="btn btn-default radius rst" type="reset">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>-->
			</div>
		</div>
	</form>
</div>
{include file="public/_footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
$('.form input[name="status"][value='+"{:cache('setting')['status']}"+']').attr("checked",true);

$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#tab-system").Huitab({
		index:0
	});
});
// /setting/saveinfo
function saveConfig(){
	$.post("{:url('setting/award')}",$('.form').serialize()).success(function(data){
		layer.msg(data.msg);
		if(!data.code){
			$('.rst').click();
		}
	});
	return false;
}
function ooo(){
	$.post("{:url('every/clear')}").success(function(data){
		layer.msg('清除成功');
	});
	return false;
}
function selecttime(flag){
	if(flag==1){
		var endTime = $("#countTimeend").val();
		if(endTime != ""){
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',maxDate:endTime})}else{
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
	}else{
		var startTime = $("#countTimestart").val();
		if(startTime != ""){
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:startTime})}else{
			WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})}
	}
}

$("#file_upload").change(function() {
        //提交
        var data = new FormData();
        // console.log($(this)[0].files[0]);
        data.append('img',$(this)[0].files[0]);
        $.ajax({
            url: '{:url("tupian")}',
            type: 'POST',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
            	if(data.code){
            		$('#background').val(data.data);
                	$('.preview').attr('src', data.data);
            	}else{
            		layer.msg(data.msg);
            	}
            	
            },
            error: function() {
                layer.msg('上传出错');
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
